package cn.com.nes.site.service.crm.flow;

import cn.com.nes.mybatis.agent.ope.entity.CrmFlowTableRelationship;
import cn.com.nes.site.entity.bo.crm.BatchSaveCrmFlowDataBO;
import cn.com.nes.site.entity.bo.crm.CrmFlowTableRelationshipBO;
import cn.com.nes.site.entity.bo.crm.sale.BatchDeleteCrmFlowDataBO;
import cn.com.nes.site.entity.vo.workOrder.GetWorkOrderInstallPageVO;
import cn.com.nes.site.service.crm.flow.dto.CrmFlowTableRelationshipDTO;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * crm流程相关表关系Service
 *
 * @Author: ShenWei
 * @Date: 2024/08/23/15:26
 */
public interface CrmFlowTableRelationshipService extends IService<CrmFlowTableRelationship> {

    /**
     * 批量新增
     */
    void batchInsertCrmFlowData(BatchSaveCrmFlowDataBO bo) throws Exception;

    /**
     * 修改crm流程关系数据
     */
    void updateCrmFlowData(CrmFlowTableRelationshipBO bo) throws Exception;

    /**
     * 批量删除crm流程关系数据 - 逻辑删除
     */
    void batchDeleteCrmFlowData(BatchDeleteCrmFlowDataBO bo) throws Exception;

    /**
     * 按某个字段查询列表
     */
    List<CrmFlowTableRelationshipDTO> selectCrmFlowDataList(CrmFlowTableRelationshipBO bo) throws Exception;

    /**
     * 按安装工单id集合查询对应项目id
     */
    Map<Long, Long> getWorkOrderProjectIdMap(Set<Long> workOrderIdSet);

    /**
     * 按项目id查询工单id集合
     */
    Set<Long> getWorkOrderIdSetByProjectId(Long projectId);

    /**
     * 按项目id集合查询工单id集合
     */
    Set<Long> getWorkOrderIdSetByProjectIdSet(Set<Long> projectIdSet);

    /**
     * 根据安装工单id查询项目id列表
     */
    List<Long> getProjectIdList(List<Long> workOrderIdList);

    /**
     * 根据安装工单id查询项目id
     */
    Long getProjectId(Long workOrderId);

    /**
     * 根据工单id列表查询系统单id列表
     */
    Map<String, List<Long>> getSaleOrderIdMap(List<Long> workOrderIdList);

    /**
     * 根据安装工单id列表删除关联数据
     */
    void batchDeleteCrmFlowData(List<Long> workOrderIdList, Date operateDate, Long operateUserId) throws Exception;

    /**
     * 根据项目信息查询工单id集合
     */
    Set<Long> getWorkOrderIdSet(GetWorkOrderInstallPageVO vo);
}
